package com.mvp.shq.washer.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mvp.shq.washer.R;
import com.mvp.shq.washer.entity.shop.Product;
import com.mvp.shq.washer.entity.shop.result.OrderDataListResult;
import com.mvp.shq.washer.utils.DataDictionary;
import com.mvp.shq.washer.utils.RecyclerViewDivider;
import com.mvp.shq.washer.utils.StringUtils;

import java.math.BigDecimal;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by westing on 2017/10/11.
 * 多商品订单列表
 */

public class OrderAllPayListAdapter extends RecyclerView.Adapter<OrderAllPayListAdapter.ViewHolder> {
    private Context context;
    private List<OrderDataListResult> productList;
    public OrderAllPayListAdapter(Context mContext, List<OrderDataListResult> productList) {
        context = mContext;
        this.productList=productList;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_orderallpay, parent, false);
        return new ViewHolder(view);
    }
    double m1=0,integra1=0;String money2 = "";
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.recyclerview.setLayoutManager(new LinearLayoutManager(context));
        RecyclerViewDivider divider = new RecyclerViewDivider(context, LinearLayoutManager.HORIZONTAL, 10, ContextCompat.getColor(context, R.color.white));
        holder.recyclerview.addItemDecoration(divider);
        OrderPayListAdapter listadapter = new OrderPayListAdapter(context,productList.get(position).getEcOrderDetailList());
        holder.recyclerview.setAdapter(listadapter);
    }


    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }


    @Override
    public int getItemCount() {
        return productList!=null?productList.size():0;
    }


    class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.recyclerview)
        RecyclerView recyclerview;
        @BindView(R.id.tv_time)
        TextView tvTime;//预计运送时间
        @BindView(R.id.tv_message)
        EditText tvMessage;//买家留言
        @BindView(R.id.tv_listnum)
        TextView tvListnum;//共计商品数量
        @BindView(R.id.tv_money_1)
        TextView tvMoney1;//小计:元
        @BindView(R.id.tv_money2)
        TextView tvMoney2;//小计:角分
        @BindView(R.id.ll_money)
        LinearLayout llMoney;
        @BindView(R.id.tv_add)
        TextView tvAdd;
        @BindView(R.id.tv_integral)
        TextView tvIntegral;//小计:积分
        @BindView(R.id.ll_integral)
        LinearLayout llIntegral;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
